
#include "nane/SoundSystem/SoundSource3D.h"
#include "nane/SoundSystem/SoundSource3DImpl_.h"
#include "nane/SoundSystem/SoundSystemImpl_.h"

namespace nane
{
    ////////////////////////////////////////////////////////////////////////////////////////////////
    SoundSource3D::SoundSource3D( const NullType& )
        : SoundSource()
        , m( NULL )
    {

    }
    ////////////////////////////////////////////////////////////////////////////////////////////////
    SoundSource3D::SoundSource3D( Implementation* _impl )
        : SoundSource( _impl )
        , m( _impl )
    {

    }
    ////////////////////////////////////////////////////////////////////////////////////////////////
    SoundSource3D::SoundSource3D( const SoundSource3D& _other )
        : SoundSource( _other )
        , m( _other.m )
    {

    }
    ////////////////////////////////////////////////////////////////////////////////////////////////
    void SoundSource3D::SetPosition( float _x, float _y, float _z )
    {
        m->posX = _x; m->posY = _y; m->posZ = _z;
        if( m->state == Implementation::EState::Playing
                || m->state == Implementation::EState::PendingStop )
        {
            m->creator->interface->SetSource3DPosition(static_cast<ISoundSource3D*>(m->interface), _x, _y, _z);
        }
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////
    void SoundSource3D::SetVelocity( float _x, float _y, float _z )
    {
        m->velX = _x; m->velY = _y; m->velZ = _z;
        if( m->state == Implementation::EState::Playing
                || m->state == Implementation::EState::PendingStop )
        {
            m->creator->interface->SetSource3DVelocity(static_cast<ISoundSource3D*>(m->interface), _x, _y, _z);
        }
    }
    ////////////////////////////////////////////////////////////////////////////////////////////////
}   // namespace nane
